﻿using System;
using System.Runtime.CompilerServices;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace SizeboxUI
{
	// Token: 0x020003AF RID: 943
	public class GameSettingsView : SettingsView
	{
		// Token: 0x170003B4 RID: 948
		// (set) Token: 0x06001904 RID: 6404 RVA: 0x0009D539 File Offset: 0x0009B739
		public GameObject RaygunSettings
		{
			set
			{
				this.raygunSettings = value;
			}
		}

		// Token: 0x170003B5 RID: 949
		// (set) Token: 0x06001905 RID: 6405 RVA: 0x0009D542 File Offset: 0x0009B742
		public GameObject AIGunSettings
		{
			set
			{
				this.aiGunSettings = value;
			}
		}

		// Token: 0x06001906 RID: 6406 RVA: 0x0009D54C File Offset: 0x0009B74C
		private void Start()
		{
			this.cam = Camera.main.GetComponent<PlayerCamera>();
			base.AddButton("Raygun Settings").onClick.AddListener(delegate()
			{
				this.OnRaygunSettingsClick();
			});
			base.AddButton("AI Gun Settings").onClick.AddListener(delegate()
			{
				this.OnAIGunSettingsClick();
			});
			base.AddHeader("Behaviour");
			this.behaviorManager = base.AddButton("Behavior Manager...");
			this.behaviorManager.onClick.AddListener(delegate()
			{
				this.OnBehaviorManagerClicked();
			});
			this.gtsBlink = base.AddToggle("Enable Blinking");
			this.gtsBlink.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.BlinkEnabled.value = value;
			});
			this.gtsAI = base.AddToggle("Enable Giantess AI");
			this.gtsAI.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.GtsAI.value = value;
			});
			this.microAI = base.AddToggle("Enable Micro AI");
			this.microAI.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.MicroAI.value = value;
			});
			this.ignorePlayer = base.AddToggle("Ignore player");
			this.ignorePlayer.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.IgnorePlayer.value = value;
			});
			this.lookAtToggle = base.AddToggle("Look At Player");
			this.lookAtToggle.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.LookAtPlayer.value = value;
			});
			base.AddHeader("City Destruction");
			this.mLowEndCities = base.AddToggle("Always Low End");
			this.mLowEndCities.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.LowEndCities.value = value;
			});
			this.mGtsBuildingDestruction = base.AddToggle("Enable for Macro NPC");
			this.mGtsBuildingDestruction.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.GtsBuildingDestruction.value = value;
			});
			this.mGtsPlayerBuildingDestruction = base.AddToggle("Enable for Macro Player");
			this.mGtsPlayerBuildingDestruction.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.GtsPlayerBuildingDestruction.value = value;
			});
			this.mMicroPlayerBuildingDestruction = base.AddToggle("Enable for Micro Player");
			this.mMicroPlayerBuildingDestruction.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.MicroPlayerBuildingDestruction.value = value;
			});
			this.mKeepDebris = base.AddToggle("Keep Chunks");
			this.mKeepDebris.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.KeepDebris.value = value;
			});
			this.mSecondaryDestruction = base.AddToggle("Secondary destruction");
			this.mSecondaryDestruction.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.SecondaryDestruction.value = value;
			});
			this.debrisCanCrush = base.AddToggle("Debris Chunks Can Crush Micros");
			this.debrisCanCrush.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.DebrisCanCrush.value = value;
			});
			base.AddHeader("Crushing");
			this.crushPlayerToggle = base.AddToggle("Allow Player Micro to be Crushed");
			this.crushPlayerToggle.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.CrushPlayerEnabled.value = value;
			});
			this.crushNpcToggle = base.AddToggle("Allow NPC Micros to be Crushed");
			this.crushNpcToggle.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.CrushNpcEnabled.value = value;
			});
			this.npcGtsCrushingToggle = base.AddToggle("Allow NPC Macros to Crush");
			this.npcGtsCrushingToggle.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.NpcGtsCrushingEnabled.value = value;
			});
			this.npcMicroCrushingToggle = base.AddToggle("Allow NPC Micros to Crush");
			this.npcMicroCrushingToggle.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.NpcMicroCrushingEnabled.value = value;
			});
			this.playerCrushingToggle = base.AddToggle("Allow Player to Crush");
			this.playerCrushingToggle.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.PlayerCrushingEnabled.value = value;
			});
			this.crushStickChance = base.AddSlider("Stick Chance", 0f, 1f);
			this.crushStickChance.onValueChanged.AddListener(delegate(float value)
			{
				GlobalPreferences.CrushStickChance.value = value;
			});
			this.stompSpeed = base.AddSlider("Stomp speed", 0.1f, 3f);
			this.stompSpeed.onValueChanged.AddListener(delegate(float value)
			{
				GlobalPreferences.StompSpeed.value = value;
			});
			this.crushStickDuration = base.AddSlider("Stuck Duration", 0f, 1f);
			this.crushStickDuration.onValueChanged.AddListener(delegate(float value)
			{
				GlobalPreferences.CrushStickDuration.value = value;
			});
			this.crushSurviveChance = base.AddSlider("Stuck Survivability", 0f, 1f);
			this.crushSurviveChance.onValueChanged.AddListener(delegate(float value)
			{
				GlobalPreferences.CrushSurviveChance.value = value;
			});
			base.AddHeader("Editor");
			this.SL_OpenOnEditor = base.AddToggle("Scene List Auto-Open");
			this.SL_OpenOnEditor.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.SL_OpenOnEditor.value = value;
			});
			this.SL_SelOnEntryClick = base.AddToggle("Scene List Auto-Select");
			this.SL_SelOnEntryClick.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.SL_SelObjOnEntryClick.value = value;
			});
			base.AddHeader("Misc");
			this.BackgroundPause = base.AddToggle("Automatically Pause When Unfocused");
			this.BackgroundPause.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.BackgroundPause.value = value;
			});
			this.scriptDebugLogging = base.AddToggle("Auxiliary Lua Debug Logging");
			this.scriptDebugLogging.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.ScriptAuxLogging.value = value;
			});
			this.Blood = base.AddToggle("Blood");
			this.Blood.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.BloodEnabled.value = value;
			});
			this.cameraEdgeScroll = base.AddToggle("Camera Edge Scrolling");
			this.cameraEdgeScroll.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.CameraEdgeScroll.value = value;
			});
			this.CityPopulation = base.AddInputSlider("Street Pop...", 5f, 500f);
			this.CityPopulation.slider.value = (float)GlobalPreferences.CityPopulation.value;
			this.CityPopulation.slider.onValueChanged.AddListener(delegate(float value)
			{
				this.CityPopulationChanged(value, true);
			});
			InputField input2 = this.CityPopulation.input;
			input2.onValidateInput = (InputField.OnValidateInput)Delegate.Combine(input2.onValidateInput, new InputField.OnValidateInput((string input, int charIndex, char addedChar) => base.ValidateDigit(addedChar)));
			this.CityPopulationChanged((float)GlobalPreferences.CityPopulation.value, false);
			this.speedSlider = base.AddSlider("Giantess Speed", 0.1f, 2f);
			if (GameController.Instance != null)
			{
				this.speedSlider.onValueChanged.AddListener(delegate(float v)
				{
					GameController.ChangeSpeed(v);
				});
			}
			this.slowToggle = base.AddToggle("Giantess Speed Affected by Scale");
			if (GameController.Instance != null)
			{
				UnityEvent<bool> onValueChanged = this.slowToggle.onValueChanged;
				if (GameSettingsView.<>f__mg$cache0 == null)
				{
					GameSettingsView.<>f__mg$cache0 = new UnityAction<bool>(GameController.SetSlowDown);
				}
				onValueChanged.AddListener(GameSettingsView.<>f__mg$cache0);
			}
			else
			{
				this.slowToggle.onValueChanged.AddListener(delegate(bool value)
				{
					GlobalPreferences.SlowdownWithSize.value = value;
				});
			}
			this.hairPhysics = base.AddToggle("Hair Physics");
			this.hairPhysics.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.HairPhysics.value = value;
			});
			this.breastPhysics = base.AddToggle("Breast Physics");
			this.breastPhysics.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.BreastPhysics.value = value;
			});
			this.gtsGrounder = base.AddToggle("Dynamic Foot Placement");
			this.gtsGrounder.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.UseGrounder.value = value;
			});
			this.Imperial = base.AddToggle("Imperial Mesurements");
			this.Imperial.onValueChanged.AddListener(delegate(bool value)
			{
				GlobalPreferences.ImperialMesurement.value = value;
			});
			this.mouseSensibility = base.AddSlider("Mouse Sensitivity", 1f, 20f);
			if (this.cam != null)
			{
				this.mouseSensibility.onValueChanged.AddListener(delegate(float v)
				{
					this.cam.SetMouseSensibility(v);
				});
			}
			else
			{
				this.mouseSensibility.onValueChanged.AddListener(delegate(float value)
				{
					GlobalPreferences.MouseSensibility.value = value;
				});
			}
			this.UpdateValues();
			this.initialized = true;
		}

		// Token: 0x06001907 RID: 6407 RVA: 0x0009DFB2 File Offset: 0x0009C1B2
		private void OnBehaviorManagerClicked()
		{
			if (UnityEngine.Object.FindObjectOfType<MainMenuSettingsController>() != null)
			{
				this.behaviorManager.GetComponentInChildren<Text>().text = "You must be in-game to use this!";
				return;
			}
			base.gameObject.SetActive(false);
			base.GetComponentInParent<PauseController>().OnBehaviorManagerClicked();
		}

		// Token: 0x06001908 RID: 6408 RVA: 0x0009DFF4 File Offset: 0x0009C1F4
		protected override void UpdateValues()
		{
			this.behaviorManager.GetComponentInChildren<Text>().text = "Behavior Manager...";
			this.SL_OpenOnEditor.isOn = GlobalPreferences.SL_OpenOnEditor.value;
			this.SL_SelOnEntryClick.isOn = GlobalPreferences.SL_SelObjOnEntryClick.value;
			this.gtsAI.isOn = GlobalPreferences.GtsAI.value;
			this.microAI.isOn = GlobalPreferences.MicroAI.value;
			this.lookAtToggle.isOn = GlobalPreferences.LookAtPlayer.value;
			this.crushPlayerToggle.isOn = GlobalPreferences.CrushPlayerEnabled.value;
			this.crushNpcToggle.isOn = GlobalPreferences.CrushNpcEnabled.value;
			this.npcGtsCrushingToggle.isOn = GlobalPreferences.NpcGtsCrushingEnabled.value;
			this.npcMicroCrushingToggle.isOn = GlobalPreferences.NpcMicroCrushingEnabled.value;
			this.playerCrushingToggle.isOn = GlobalPreferences.PlayerCrushingEnabled.value;
			this.slowToggle.isOn = GlobalPreferences.SlowdownWithSize.value;
			this.ignorePlayer.isOn = GlobalPreferences.IgnorePlayer.value;
			this.hairPhysics.isOn = GlobalPreferences.HairPhysics.value;
			this.breastPhysics.isOn = GlobalPreferences.BreastPhysics.value;
			this.gtsGrounder.isOn = GlobalPreferences.UseGrounder.value;
			this.mSecondaryDestruction.isOn = GlobalPreferences.SecondaryDestruction.value;
			this.mKeepDebris.isOn = GlobalPreferences.KeepDebris.value;
			this.mLowEndCities.isOn = GlobalPreferences.LowEndCities.value;
			this.Blood.isOn = GlobalPreferences.BloodEnabled.value;
			this.mMicroPlayerBuildingDestruction.isOn = GlobalPreferences.MicroPlayerBuildingDestruction.value;
			this.mGtsPlayerBuildingDestruction.isOn = GlobalPreferences.GtsPlayerBuildingDestruction.value;
			this.mGtsBuildingDestruction.isOn = GlobalPreferences.GtsBuildingDestruction.value;
			this.stompSpeed.value = GlobalPreferences.StompSpeed.value;
			this.crushStickChance.value = GlobalPreferences.CrushStickChance.value;
			this.crushStickDuration.value = GlobalPreferences.CrushStickDuration.value;
			this.crushSurviveChance.value = GlobalPreferences.CrushSurviveChance.value;
			this.Imperial.isOn = GlobalPreferences.ImperialMesurement.value;
			this.gtsBlink.isOn = GlobalPreferences.BlinkEnabled.value;
			this.scriptDebugLogging.isOn = GlobalPreferences.ScriptAuxLogging.value;
			this.cameraEdgeScroll.isOn = GlobalPreferences.CameraEdgeScroll.value;
			if (this.cam != null)
			{
				this.mouseSensibility.value = this.cam.orbit.mouseSensibility;
			}
			else
			{
				this.mouseSensibility.value = GlobalPreferences.MouseSensibility.value;
			}
			if (this.slowToggle != null)
			{
				this.slowToggle.isOn = GlobalPreferences.SlowdownWithSize.value;
			}
			if (this.speedSlider != null)
			{
				this.speedSlider.value = GameController.globalSpeed;
			}
		}

		// Token: 0x06001909 RID: 6409 RVA: 0x0009E31C File Offset: 0x0009C51C
		private void CityPopulationChanged(float value, bool write = false)
		{
			int num = (int)value;
			base.SetInputSliderInput(this.CityPopulation, num);
			if (write)
			{
				GlobalPreferences.CityPopulation.value = num;
			}
		}

		// Token: 0x0600190A RID: 6410 RVA: 0x0009E34A File Offset: 0x0009C54A
		private void OnRaygunSettingsClick()
		{
			this.raygunSettings.SetActive(true);
			base.gameObject.SetActive(false);
		}

		// Token: 0x0600190B RID: 6411 RVA: 0x0009E364 File Offset: 0x0009C564
		private void OnAIGunSettingsClick()
		{
			this.aiGunSettings.SetActive(true);
			base.gameObject.SetActive(false);
		}

		// Token: 0x04001B05 RID: 6917
		private Toggle lookAtToggle;

		// Token: 0x04001B06 RID: 6918
		private Toggle SL_OpenOnEditor;

		// Token: 0x04001B07 RID: 6919
		private Toggle SL_SelOnEntryClick;

		// Token: 0x04001B08 RID: 6920
		private Toggle cameraEdgeScroll;

		// Token: 0x04001B09 RID: 6921
		private Toggle crushPlayerToggle;

		// Token: 0x04001B0A RID: 6922
		private Toggle crushNpcToggle;

		// Token: 0x04001B0B RID: 6923
		private Toggle playerCrushingToggle;

		// Token: 0x04001B0C RID: 6924
		private Toggle npcMicroCrushingToggle;

		// Token: 0x04001B0D RID: 6925
		private Toggle npcGtsCrushingToggle;

		// Token: 0x04001B0E RID: 6926
		private Toggle slowToggle;

		// Token: 0x04001B0F RID: 6927
		private Toggle ignorePlayer;

		// Token: 0x04001B10 RID: 6928
		private Button behaviorManager;

		// Token: 0x04001B11 RID: 6929
		private Toggle gtsAI;

		// Token: 0x04001B12 RID: 6930
		private Toggle microAI;

		// Token: 0x04001B13 RID: 6931
		private Toggle microFleeing;

		// Token: 0x04001B14 RID: 6932
		private Toggle hairPhysics;

		// Token: 0x04001B15 RID: 6933
		private Toggle breastPhysics;

		// Token: 0x04001B16 RID: 6934
		private Toggle gtsBlink;

		// Token: 0x04001B17 RID: 6935
		private Toggle gtsGrounder;

		// Token: 0x04001B18 RID: 6936
		private Toggle Imperial;

		// Token: 0x04001B19 RID: 6937
		private Toggle BackgroundPause;

		// Token: 0x04001B1A RID: 6938
		private Toggle mSecondaryDestruction;

		// Token: 0x04001B1B RID: 6939
		private Toggle mKeepDebris;

		// Token: 0x04001B1C RID: 6940
		private Toggle mLowEndCities;

		// Token: 0x04001B1D RID: 6941
		private Toggle debrisCanCrush;

		// Token: 0x04001B1E RID: 6942
		private Toggle Blood;

		// Token: 0x04001B1F RID: 6943
		private Toggle scriptDebugLogging;

		// Token: 0x04001B20 RID: 6944
		private Toggle mGtsBuildingDestruction;

		// Token: 0x04001B21 RID: 6945
		private Toggle mMicroPlayerBuildingDestruction;

		// Token: 0x04001B22 RID: 6946
		private Toggle mGtsPlayerBuildingDestruction;

		// Token: 0x04001B23 RID: 6947
		private Slider stompSpeed;

		// Token: 0x04001B24 RID: 6948
		private Slider crushStickChance;

		// Token: 0x04001B25 RID: 6949
		private Slider crushStickDuration;

		// Token: 0x04001B26 RID: 6950
		private Slider crushSurviveChance;

		// Token: 0x04001B27 RID: 6951
		private Slider speedSlider;

		// Token: 0x04001B28 RID: 6952
		private Slider mouseSensibility;

		// Token: 0x04001B29 RID: 6953
		private SettingsView.InputSlider CityPopulation;

		// Token: 0x04001B2A RID: 6954
		private GameObject raygunSettings;

		// Token: 0x04001B2B RID: 6955
		private GameObject aiGunSettings;

		// Token: 0x04001B2C RID: 6956
		private PlayerCamera cam;

		// Token: 0x04001B2D RID: 6957
		[CompilerGenerated]
		private static UnityAction<bool> <>f__mg$cache0;
	}
}
